{% extends "learn_app/base.html"%}
{% block header %}
Topics:
{% endblock %}

{% block content %}
{% if request.user.is_authenticated %}
    <a href="{% url 'learn_app:new_topic' %}">创建新主题<br></a>
    <span class="badge">我的主题<br></span>
    {% with topics=public_topics title="已公开主题" badge_class="bg-success" %}
    {% include "learn_app/topics_list.html" %}
    {% endwith %}

    {% with topics=private_topics title="私有主题" badge_class="bg-secondary" %}
    {% include "learn_app/topics_list.html" %}
    {% endwith %}
{% endif %}
公开主题:<br>
{% for public_topic in others_public_topics %}
    <a href="{% url 'learn_app:topic' public_topic.id %}" style="margin-right: 20px";>•{{public_topic}}</a>
    {{public_topic.date_added|date:'Y-m-d;H:i'}}&nbsp&nbsp作者:{{public_topic.owner}}<br>
    {% empty %}
    •NO topics have been publiced yet.
{% endfor %}
<!-- 分页导航 -->
<div class="pagination">
    <span class="step-links">
    {% if others_public_topics.has_previous %}
      <a href="?page=1">&laquo; 第一页</a>
      <a href="?page={{ others_public_topics.previous_page_number }}">上一页</a>
    {% endif %}
    <span class="current">
      第 {{ others_public_topics.number }} 页，共 {{ others_public_topics.paginator.num_pages }} 页
    </span>
    {% if others_public_topics.has_next %}
      <a href="?page={{ others_public_topics.next_page_number }}">下一页</a>
      <a href="?page={{ others_public_topics.paginator.num_pages }}">最后一页 &raquo;</a>
    {% endif %}
    </span>
</div>
{% endblock %}